import * as Relay from "react-relay";

export default class DeleteCompanyMutation extends Relay.Mutation {
  static fragments = {};

  getConfigs() {
    return [{
      type: 'NODE_DELETE',
      parentName: 'viewer',
      parentID: this.props.viewer.id,
      connectionName: 'companies',
      deletedIDFieldName: 'id',
    }];
  }

  getMutation = () => Relay.QL`mutation { deleteCompany }`;

  getVariables() {
    return { ...this.props.payload };
  }

  getFatQuery = () => (
    Relay.QL`
      fragment on deleteCompanyPayload {
        id
        viewer{
          id
          companies
        }
      }
    `
  )
}
